import { login as loginApi } from "@/service/user";
import * as types from "../types";
export const login = (loginFrom) => (dispatch) => {
  // console.log(loginFrom);
  return new Promise((resolve, reject) => {
    loginApi(loginFrom)
      .then((res) => {
        dispatch({
          type: types.SET_TOKEN,
          payload: res.data.message.token,
        });
        resolve();
      })
      .catch((err) => {
        reject(err);
      });
  });
};
